Redux, useSelector, useDispatch


用 hooks 取代 connect

connect => hooks
取資料: mapStateToProps => useSelector
更新資料: mapDispatchToProps => useDispatch

import { Provider, useSelector, useDispatch } from 'react-redux';
import { addTodo } from './action/todolist';







你可能感興趣的文章

Web開發學習筆記07 — bind、call、apply

Web開發學習筆記07 — bind、call、apply

Leetcode 刷題 pattern - Merge Intervals

Leetcode 刷題 pattern - Merge Intervals

AWS Solutions Architect - Associate (SAA) 學習計畫與備考心得: Module 9

AWS Solutions Architect - Associate (SAA) 學習計畫與備考心得: Module 9






留言討論